﻿Imports Utilerias

Public Class ReportesBL
    Public Function getListadoReportesFacturaPorRFC(ByVal pRfc As String) As List(Of String)
        Dim ListaReportes As List(Of String) = New List(Of String)
        Try
            If (Not System.IO.Directory.Exists(System.IO.Path.Combine(My.Settings.PathFiles, "rptsGenericos\CFDI\"))) Then
                Return Nothing
            End If

            For Each file As String In System.IO.Directory.GetFiles(System.IO.Path.Combine(My.Settings.PathFiles, "rptsGenericos\CFDI\"), "*.rpt", System.IO.SearchOption.TopDirectoryOnly)
                ListaReportes.Add(System.IO.Path.GetFileNameWithoutExtension(file))
            Next

            If (System.IO.Directory.Exists(System.IO.Path.Combine(My.Settings.PathFiles, pRfc, "rptsPersonalizados\CFDI"))) Then
                For Each fileRFC As String In System.IO.Directory.GetFiles(System.IO.Path.Combine(My.Settings.PathFiles, pRfc, "rptsPersonalizados\CFDI"), "*.rpt", System.IO.SearchOption.TopDirectoryOnly)
                    ListaReportes.Add(System.IO.Path.GetFileNameWithoutExtension(fileRFC))
                Next
            End If

            Return ListaReportes
        Catch ex As Exception
            Log.LogException(ex, "ReportesBE.GetListadoReportesFacturaPorRFC")
            Return Nothing
        End Try
    End Function
End Class
